/*
 * main.c
 *
 *  Created on: 20/11/2012
 *      Author: julian
 */

#include <stdio.h>
#include <errno.h>
#include <pthread.h>
#include <signal.h>

#include "cli_message_def.h"
#include "cli_message.h"
#include "LR1.h"

void * thr_com2(void* arg) {

    while(1) {
        avanzarDistanciaCM(80, 40, "LR101", NULL);
        sleep(1);
        retroceder(80, "LR101", NULL);
        sleep(1);
    }
}

void * thr_com(void* arg) {

    while(1) {
        girarGrados(RIGHT_DEG, 60, 30, "LR101", NULL);
        sleep(1);
        girarGrados(LEFT_DEG, 60, 30, "LR101", NULL);
        sleep(1);
    }
}

pthread_t thr1, thr2;

void quit(int sig) {

    if (msgSvcExit() < 0) {
        perror("msg_exit");
        exit(2);
    }
    exit(0);
}

int main() {

    if (msgSvcInit() < 0) {
        perror("init");
        exit(1);
    }

    signal(SIGINT, quit);
    //comander();
    wander();

    if (msgSvcExit() < 0) {
        perror("msg_exit");
        exit(2);
    }
    return 0;
}

